package ar.edu.itba.tp1.tpmariano;

import ar.edu.itba.tp1.gps.api.GPSRule;
import ar.edu.itba.tp1.gps.api.GPSState;
import ar.edu.itba.tp1.gps.exception.NotAppliableException;

public class RotateGPSRule implements GPSRule {

	private int x;
	private int y;

	public RotateGPSRule(int x, int y) {
		this.x = x;
		this.y = y;
	}

	@Override
	public String getName() {
		return "ROTATE RULE: (" + x + "," + y + ") ";
	}

	@Override
	public GPSState evalRule(GPSState state) throws NotAppliableException {
		GPSState ans = state.copyState();
		((Grid) ans).rotateRight(x, y);
		return ans;
	}
	
	@Override
	public Integer getCost() {
		return 1;
		
	}

}
